home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol E-12 / (Vol E-12) May 21 2012.iso / Animations / dj / dj.swf / scripts / __Packages / mx / controls / scrollClasses / ScrollThumb.as < prev   
Text File  |  2012-05-21  |  2KB  |  83 lines

  1. class mx.controls.scrollClasses.ScrollThumb extends mx.skins.CustomBorder
  2. {
  3.    static var symbolOwner = mx.skins.CustomBorder.symbolOwner;
  4.    var className = "ScrollThumb";
  5.    var btnOffset = 0;
  6.    var horizontal = false;
  7.    var idNames = new Array("l_mc","m_mc","r_mc","grip_mc");
  8.    function ScrollThumb()
  9.    {
  10.       super();
  11.    }
  12.    function createChildren(Void)
  13.    {
  14.       super.createChildren();
  15.       this.useHandCursor = false;
  16.    }
  17.    function setRange(_ymin, _ymax, _datamin, _datamax)
  18.    {
  19.       this.ymin = _ymin;
  20.       this.ymax = _ymax;
  21.       this.datamin = _datamin;
  22.       this.datamax = _datamax;
  23.    }
  24.    function dragThumb(Void)
  25.    {
  26.       this.scrollMove = this._ymouse - this.lastY;
  27.       this.scrollMove += this._y;
  28.       if(this.scrollMove < this.ymin)
  29.       {
  30.          this.scrollMove = this.ymin;
  31.       }
  32.       else if(this.scrollMove > this.ymax)
  33.       {
  34.          this.scrollMove = this.ymax;
  35.       }
  36.       this._parent.isScrolling = true;
  37.       this._y = this.scrollMove;
  38.       var _loc2_ = Math.round((this.datamax - this.datamin) * (this._y - this.ymin) / (this.ymax - this.ymin)) + this.datamin;
  39.       this._parent.scrollPosition = _loc2_;
  40.       this._parent.dispatchScrollEvent("ThumbTrack");
  41.       updateAfterEvent();
  42.    }
  43.    function stopDragThumb(Void)
  44.    {
  45.       this._parent.isScrolling = false;
  46.       this._parent.dispatchScrollEvent("ThumbPosition");
  47.       this._parent.dispatchScrollChangedEvent();
  48.       delete this.onMouseMove;
  49.    }
  50.    function onPress(Void)
  51.    {
  52.       this._parent.pressFocus();
  53.       this.lastY = this._ymouse;
  54.       this.onMouseMove = this.dragThumb;
  55.       super.onPress();
  56.    }
  57.    function onRelease(Void)
  58.    {
  59.       this._parent.releaseFocus();
  60.       this.stopDragThumb();
  61.       super.onRelease();
  62.    }
  63.    function onReleaseOutside(Void)
  64.    {
  65.       this._parent.releaseFocus();
  66.       this.stopDragThumb();
  67.       super.onReleaseOutside();
  68.    }
  69.    function draw()
  70.    {
  71.       super.draw();
  72.       if(this.grip_mc == undefined)
  73.       {
  74.          this.setSkin(3,this.gripSkin);
  75.       }
  76.    }
  77.    function size()
  78.    {
  79.       super.size();
  80.       this.grip_mc.move((this.__get__width() - this.grip_mc.width) / 2,(this.__get__height() - this.grip_mc.height) / 2);
  81.    }
  82. }
  83.